<template>
	<view class="main">

		<!-- tabs -satrt -->
		<view class="tabs">
		<u-tabs :list="list4" lineWidth="20" lineHeight="7" :lineColor="`url(${lineBg}) 100% 100%`" :activeStyle="{
		        color: '#111111',
		        fontWeight: 'bold',
		        transform: 'scale(1.05)'
		    }" :inactiveStyle="{
		        color: '#111111',
		        transform: 'scale(1)'
		    }" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"
			@click="switchTabs">
		</u-tabs>
		</view>
		<!-- tabs -end -->



		<!--list-satrt -->
		<view class="list">
			<view class="item" v-for="item in 6">

				<view class="item-right">
					<view class="item-name">
						<span>订单编号:PO2023060515304</span>
						<view class="item-btn" @click="toDetail">已成交</view>
						<!-- <view class="item-btn item-btn-red">待审核</view> -->
						<!-- <view class="item-btn item-btn-yellow">进行中</view> -->
						<!-- <view class="item-btn item-btn-gray">作废</view> -->
					</view>
					<view class="item-single">
						<span class="item-single-name">供应商名称</span>
						<span class="item-single-value">北京建龙重工集团有限公司</span>
					</view>
					<view class="item-single">
						<span class="item-single-name">存货名称</span>
						<span class="item-single-value">计算机</span>
					</view>
					<view class="item-single">
						<span class="item-single-name">单价</span>
						<span class="item-single-value">¥80.00</span>
					</view>
					<view class="item-bottom">
						<span>总价：</span>
						<span class="item-bottom-tag"><span class="item-bottom-tag-unit">¥</span>800.00</span>
					</view>
					<view class="item-note">
						<span class="item-note-name">作废原因</span>
						<span class="item-note-tip">这里是作废原因，可以折行这里是作废原因，可以折行</span>
					</view>
				</view>

			</view>
		</view>
		<!--list-end -->


		<view class="list-end" v-if="dataList.length">{{endText}}</view>

		<u-empty v-if="!dataList.length" mode="car" text="暂无数据" icon="/static/empty-img.png">
		</u-empty>

	</view>
</template>

<script>
	import db from '@/common/localstorage.js'
	export default {
		data() {
			return {
				lineBg: "",
				list4: [{
					name: '全部'
				}, {
					name: '成交订单',
				}, {
					name: '待审核',
				}, {
					name: '进行中'
				}, {
					name: '作废'
				}],


				userInfo: {},
				queryParams: {
					flag: 1,
					pageNo: 1,
					pageSize: 10
				},
				total: 0,
				endText: '',
				dataList: []

			}
		},
		onLoad() {
			// this.userInfo = db.get('userInfo')
		},
		onShow() {
			this.queryParams.pageNo = 1
			this.dataList = []

		},
		methods: {

			getList() {
				this.$modal.msgLoading('加载中')

				var that = this
				let url = this.queryParams.flag == 1 ? '/app-api/proj/major-projects/page' :
					'/app-api/proj/dpk/m-simple-list'
				this.$get(url, this.queryParams).then(res => {
					uni.hideLoading()
					if (res.data.code == 0) {
						let detail = res.data.data.list

						if (detail.length < that.queryParams.pageSize) {
							that.endText = '没有更多了'
						}
						that.total = res.data.data.total
						that.dataList = that.dataList.concat(detail)
					} else {
						uni.showToast({
							title: res.data.msg,
							icon: 'none'
						})
					}
				})
			},
			switchTabs(item) {
				console.log(item)
				// this.queryParams.flag = flag
				// this.queryParams.pageNo = 1
				// this.dataList = []
				// this.getList()
			},




			toDetail(id) {
				uni.navigateTo({
					url: '/pagesMain/storage/laboratory/form'
				})
			},


		},

		onReachBottom: function(e) {
			if (this.total > this.dataList.length) {
				(this.queryParams.pageNo) ++;
				this.getList()
			}
		},
	}
</script>

<style lang="scss" scoped>
	page {
		background: #F9F9F9;
	}

	.main {
		padding: 0;
		padding-bottom: 260upx;
	}

	.list {
		padding: 0 24upx;
		width: calc(100% - 48upx);

		.item {
			margin-bottom: 20upx;
			width: calc(100% - 60upx);
			background: #FFFFFF;
			border-radius: 10upx;
			padding: 30upx;
			display: flex;
			justify-content: space-between;


			.item-right {
				width: calc(100%);
				position: relative;

				.item-name {
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #9B9B9B;
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding-bottom: 12upx;
					margin-bottom: 14upx;
				}

				.item-single {
					display: flex;
					align-items: center;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #666666;
					margin-top: 10upx;
				}

				.item-single-name {
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #666666;
					width: 120rpx;
					display: inline-block;
					margin-right: 12upx;

				}

				.item-single-value {
					display: inline-block;
					width: calc(100% - 120upx - 12upx);
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 28rpx;
					color: #111111;
				}




				.item-btn {
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 28rpx;
					color: #11AA66;
				}

				.item-btn-red {
					color: #F01022;
				}

				.item-btn-yellow {
					color: #FE9406;
				}

				.item-btn-gray {
					color: #999999;
				}
			}



			.item-bottom {
				flex: 0 0 100%;
				padding-top: 20upx;
				border-top: solid 1rpx rgba(228, 228, 228, 0.6);
				margin-top: 20upx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 24rpx;
				color: #666666;
				display: flex;
				justify-content: space-between;

				.item-bottom-tag {
					font-family: Roboto, Roboto;
					font-weight: 500;
					font-size: 36rpx;
					color: #111111;
				}

				.item-bottom-tag-unit {
					font-family: PingFangHK, PingFangHK;
					font-weight: 500;
					font-size: 24rpx;
					color: #111111;
				}
			}

			.item-note {
				padding: 12upx 20upx;
				width: calc(100% - 40upx);
				background: #F7F7F7;
				border-radius: 10rpx;
				margin-top: 12upx;

				.item-note-name {
					font-family: PingFangSC, PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #111111;
					margin-right: 10upx;
				}

				.item-note-tip {
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #999999;
				}
			}
		}

	}

	.tabs {
		// margin-top: 26upx;
		width: 100%;
		height: 106upx;
		display: flex;
		align-items: center;
		justify-content: center;
		z-index: 3;
		position: relative;
		background: #FFFFFF;
		margin-bottom: 20upx;

	::v-deep .u-tabs__wrapper__nav__line{
		bottom:-2px;
	}
	}
</style>